package com.lyshop.jinxiang.view;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

import com.lyshop.jinxiang.R;


public class CertCardFailedDialog extends MyDialog implements View.OnClickListener {

    private View rootView;
    private ImageView iv_close;
    private Button bt_submit;

    private CertCardFailedDialogListener mListener;

    public CertCardFailedDialog(Context context, CertCardFailedDialogListener listener) {
        this(context, true, Gravity.CENTER);
        this.mListener = listener;
    }

    public CertCardFailedDialog(Context context, boolean isCancelAble, int gravity) {
        super(context, isCancelAble, gravity);
        rootView = LayoutInflater.from(context).inflate(R.layout.dialog_card_failed, null);
        setContentView(rootView);

        iv_close = rootView.findViewById(R.id.iv_close);
        bt_submit = rootView.findViewById(R.id.bt_submit);

        iv_close.setOnClickListener(this);
        bt_submit.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.iv_close:
                mListener.onCancel();
                break;
            case R.id.bt_submit:
                mListener.onConfirm();
                break;
        }
    }


    public interface CertCardFailedDialogListener {

        void onConfirm();

        void onCancel();
    }


}
